From: Jonas Dreßler Date: Mon, 17 Feb 2020 15:21:58 +0000 (+0100) Subject: appDisplay: Reload folder views on installed app changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~751^2^2~160 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3155d03d9e97702d7dd963817bcb231bd813584e;p=gnome-shell.git appDisplay: Reload folder views on installed app changes Since the FolderViews are not connected to the "installed-changed" signal, we need to reload their apps by calling _redisplay() when an app is removed or installed. We can't connect to "installed-changed" inside FolderView because we need to ensure _redisplay() of the FolderView is called before AppView tries to access the apps of the folder inside _refilterApps(). So reload the FolderViews inside AllViews _redisplay() implementation to ensure everything is up to date before accessing the apps of the folder. Since the "apps-changed" signal of FolderIcon now indirectly triggers a _redisplay() of the FolderViews, the 'changed' handler of FolderView is now redundant and can be removed. Because of this, we also need to move the emission of the "apps-changed" signal to the start of the signal handler to make sure the view is updated before we try to access items of the view. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1901 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 3d0bea97b..cdd1756c2 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -431,6 +431,10 @@ var AllView = GObject.registerClass({ _redisplay() { super._redisplay(); + + this._folderIcons.forEach(icon => { + icon.view._redisplay(); + }); this._refilterApps(); } @@ -1324,20 +1328,9 @@ class FolderView extends BaseAppView { action.connect('pan', this._onPan.bind(this)); this._scrollView.add_action(action); - this.connect('destroy', this._onDestroy.bind(this)); - - this._folderChangedId = this._folder.connect( - 'changed', this._redisplay.bind(this)); this._redisplay(); } - _onDestroy() { - if (this._folderChangedId) { - this._folder.disconnect(this._folderChangedId); - delete this._folderChangedId; - } - } - _childFocused(actor) { Util.ensureActorVisibleInScrollView(this._scrollView, actor); } @@ -1630,10 +1623,10 @@ var FolderIcon = GObject.registerClass({ } _sync() { + this.emit('apps-changed'); this._updateName(); this.visible = this.view.getAllItems().length > 0; this.icon.update(); - this.emit('apps-changed'); } _createIcon(iconSize) {